//
//  ActicityShowDetailViewController.m
//  JxCarios
//
//  Created by phev on 15/2/10.
//  Copyright (c) 2015年 xiongchuanqi. All rights reserved.
//

#import "ActicityShowDetailViewController.h"
#import "WXActivityApplyViewController.h"
#import "LoginViewController.h"

@interface ActicityShowDetailViewController ()

@end

@implementation ActicityShowDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"活动详情";
    [self showNavBarWithRightTitle:nil andRightAction:nil andLeftAction:@selector(backTo) andCustom:NO];
    [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[_info customObjectForkey:@"CONTENT"]]]];
    _webView.delegate = self;
    _webView.scalesPageToFit = NO;
    if ([[_info customObjectForkey:@"IS_APPLY"] isEqualToString:@"no"]) {
        [_signUp setBackgroundColor:[UIColor grayColor]];
        
    }
}

- (void)setInfo:(NSDictionary *)info {
     if (info) {
        _info = info;
         
      
    }
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
    [self.view hideToastActivity];
}

- (void)webViewDidStartLoad:(UIWebView *)webView{
    [self.view makeToastActivity:TOP_POINT  ];
}

- (void)backTo {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}

 
- (IBAction)signUpAction:(id)sender {
    if ([[_info customObjectForkey:@"IS_APPLY"] isEqualToString:@"no"]) {
        return;
    }
    if (![Common currenLoginStatus]) {
        LoginViewController *login = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginView"];
        CLUIBaseNavigationController *base = [[CLUIBaseNavigationController alloc] initWithRootViewController:login];
        [self presentViewController:base animated:YES completion:nil];
        
    }else{

    WXActivityApplyViewController *activity = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ActivityApply"];
    activity.dicinfo = [_info copy];
    [self.navigationController pushViewController:activity animated:YES];
        
    }
}
@end
